function GetSGproto(){
    this.timeShow = document.getElementById("timeShow");
    this.timeShowChild = this.timeShow.children;
    // this.showWrwp = document.getElementsByClassName("show_wrap")[0];
    this.toLeftoo = document.getElementById("toLeftoo");
    this.toRightoo = document.getElementById("toRightoo");
    this.index = 0;
    this.timer = null;
}

GetSGproto.prototype.init = function(){
    this.setTimeval();
    this.toLeftOver();
    this.toLeftout();
    this.toRightOver();
    this.toRightout();
}

GetSGproto.prototype.setTimeval = function () {
    this.timer = setInterval(() => {
        if(this.index === 2){
            this.index = 0;
        }else{
            this.index++;
        }
        // console.log(this.timeShowChild)
        for(let i=0; i<this.timeShowChild.length; i++){
            // console.log(11);
            animate(this.timeShowChild[i],{opacity:0});
        }
        animate(this.timeShowChild[this.index],{opacity:100});
    }, 4000);
}


GetSGproto.prototype.toLeftOver = function(){
    this.toLeftoo.addEventListener("mouseover",()=>{
        clearInterval(this.timer);
    })
    this.toLeftoo.addEventListener("click",()=>{
        if(this.index === 0){
            this.index = 0;
        }else{
            this.index--;
        }
        for(let i=0; i<this.timeShowChild.length; i++){
            animate(this.timeShowChild[i],{opacity:0});
        }
        animate(this.timeShowChild[this.index],{opacity:100});
    })
}
GetSGproto.prototype.toLeftout = function(){
    this.toLeftoo.addEventListener("mouseout",()=>{
        this.setTimeval();
    })
}

GetSGproto.prototype.toRightOver = function(){
    this.toRightoo.addEventListener("mouseover",()=>{
        clearInterval(this.timer);
    })
    this.toRightoo.addEventListener("click",()=>{
        if(this.index === 2){
            this.index = 2;
        }else{
            this.index++;
        }
        for(let i=0; i<this.timeShowChild.length; i++){
            animate(this.timeShowChild[i],{opacity:0});
        }
        animate(this.timeShowChild[this.index],{opacity:100});
    })
}
GetSGproto.prototype.toRightout = function(){
    this.toRightoo.addEventListener("mouseout",()=>{
        this.setTimeval();
    })
}

new GetSGproto().init();